package com.juzi.suijishuRandom;

public class JieShao {
    public static void main(String[] args) {
        System.out.println("==============\n" +
                "Random随机数技术\n" +
                "作用：用于在程序中获取随机数的技术。\n" +
                "--------------\n" +
                "使用步骤：\n" +
                "                                            package com.itheima.random;\n" +
                "①：导包：告诉程序去JDK的哪个包中找随机数技术       import java.util.Random;\n" +
                "                                            public class Test {\n" +
                "                                                public static void main(String[] args) {\n" +
                "②：写一行代码代表得到随机数对象                          Random r = new Random();\n" +
                "③：调用随机数的功能获取0-9的随机数                       int number = r.nextInt(10);\n" +
                "                                                    System.out.println(“随机生成了：” + number);\n" +
                "                                                }\n" +
                "                                            }\n" +
                "---------------\n" +
                "注意：\n" +
                "nextInt(n) 功能只能生成: 0 至 n-1之间的随机数，不包含n。\n" +
                "-----------------\n" +
                "Random生成随机数的特点\n" +
                " nextInt(n)功能只能生成：0 – (n-1)之间的随机数。\n" +
                "-------------------------\n" +
                "Random生成区间随机数的技巧：减加法。\n" +
                " 例如：要生成 1 – 10之间的随机数，程序怎么实现？\n" +
                "1- 10     --> -1 --> （0-9）+ 1\n" +
                "\n" +
                "Random r = new Random();\n" +
                "int number = r.nextInt(10) + 1; // 1-10\n" +
                "               (0-9)\n" +
                "---------------\n" +
                "Random随机数类生成需要几步，具体是什么样的？\n" +
                "导包：import java.util.Random;\n" +
                "Random r = new Random();\n" +
                "int number = r.nextInt(10);\n" +
                "\n" +
                "----------------\n" +
                "2. Random随机数如何生成 65 – 91之间的随机数？\n" +
                "65 – 91  => （0 - 26）+ 65\n" +
                "int number = r.nextInt(27) + 65;\n");
    }
}
